<template>
    <div>
     <div @click="openDg(1)">
        <el-input v-model="landmarkNames" placeholder="请选择AR地标" maxlength="50" type="text" class="headInput" :readonly="true" />
     </div>
     
        <my-teleport to="body" v-if="lkFlag">
            <my-dialog :show.sync="lkFlag" width="500px" title="关联AR地标" @confirm="getSelectData">   
                <my-table v-if="dataType==1" :loading="loading" :lists="tableData" @selectionChange="tableSelect" @pageChange="handleChange" :showCheck="true" :sequence="true" :page='page' selectKey="arLandmarkId|name">
                    <el-table-column property="arLandmarkId" label="地标ID" align='left'></el-table-column>
                    <el-table-column property="name" label="地标名称" align='center'></el-table-column>
                </my-table>
            </my-dialog> 
        </my-teleport>
    </div>
</template>

<script>
import {mapGetters} from 'vuex'
import {
  getLandmarkList
} from '@/api/arApi'
import myDialog from '@/components/public/myDialog';
import myTable from '@/components/public/myTable';
import myTeleport from './myTeleport.vue';
export default {
    components:{
        myDialog,
        myTable,
        myTeleport
    },
    data(){
        return{
            landmarkNames:'',
            lkFlag:false,
            page:{
                pageSize:10,
                pageIndex:1,
			    total:0,
            },
            loading:true,
            tableData:[],
            multipleSelectionIds:[],
            dataType:1
        }
    },
    computed:{
        ...mapGetters({
            'goodsAddParams':'goods/goodsAddParams'
        })
    },
    created(){
        
    },
    methods:{
        openDg(num){
            this.lkFlag=true
            this.page.pageIndex = 1;
            this.tableData=[]
            this.getList()
        },
        async getList(){
            const params = {
                limit: this.page.pageSize,
                page: this.page.pageIndex
            }
            const res = await getLandmarkList(params)  // 获取地标
            this.loading = false
            this.tableData = res.data
            this.page.total = res.total
            
        },
        getSelectData(){
            this.lkFlag = false
        },
        tableSelect(obj,items){
            
        },
        handleChange(index) {
            this.page.pageIndex = index;
            this.getList();
        }
    }
}
</script>

<style lang="scss" scoped>
    .public_head {
            ul {
                padding: 0;
                display: flex;
                flex-wrap: wrap;
                padding: 30px 50px 10px 84px;
                box-sizing: border-box;
                margin: 0;
                li {
                    display: flex;
                    width: 50%;
                    margin-bottom: 20px;
                    align-items: center;
                    p {
                        width: 120px;
                        span {
                            color: #ff0000;
                        }
                    }
                    .headInput {
                        width: 400px;
                    }
                }
            }
        }
</style>